package com.cloudcross.ssp.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloudcross.ssp.base.dao.GenericIBatisDao;
import com.cloudcross.ssp.common.utils.Pager;
import com.cloudcross.ssp.model.rpt.JsAdRpt;
import com.cloudcross.ssp.model.rpt.Report;
import com.cloudcross.ssp.service.IRptJsAdService;

@Service
public class RptJsAdService implements IRptJsAdService {

    @Autowired
    private GenericIBatisDao myBatisDao;

    @Override
    public List<JsAdRpt> queryJsAdDataByCondition(Map<String, Object> condition, Pager pager) {
        String namespace = "";
        if (pager == null) {
            namespace = "rptSqlMapper.queryJsAdDataExcelByCondition";
        } else {
            namespace = "rptSqlMapper.queryJsAdDataByCondition";
            condition.put("pager", pager);
        }
        return this.myBatisDao.getList(namespace, condition);
    }

    @Override
    public int queryJsAdCountByCondition(Map<String, Object> condition) {
        return this.myBatisDao.get("rptSqlMapper.queryJsAdCountByCondition", condition);
    }

    @Override
    public Report queryJsAdTotalByCondition(Map<String, Object> condition) {
        return this.myBatisDao.get("rptSqlMapper.queryJsAdTotalByCondition", condition);
    }

    @Override
    public int queryAppAdCountByCondition(Map<String, Object> condition) {
        return this.myBatisDao.get("rptSqlMapper.queryAppAdCountByCondition", condition);
    }

    @Override
    public List<JsAdRpt> queryAppAdDataByCondition(Map<String, Object> condition, Pager pager) {
        String namespace = "";
        if (pager == null) {
            namespace = "rptSqlMapper.queryAppAdDataExcelByCondition";
        } else {
            namespace = "rptSqlMapper.queryAppAdDataByCondition";
            condition.put("pager", pager);
        }
        return this.myBatisDao.getList(namespace, condition);
    }

    @Override
    public Report queryAppAdTotalByCondition(Map<String, Object> condition) {
        return this.myBatisDao.get("rptSqlMapper.queryAppAdTotalByCondition", condition);
    }

}
